package com.hkj.genealogy.genealogydemo.service;

import com.hkj.genealogy.genealogydemo.entity.Member;
import com.hkj.genealogy.genealogydemo.entity.MemberTree;
import com.hkj.genealogy.genealogydemo.mapper.MemberMapper;
import com.hkj.genealogy.genealogydemo.service.api.MemberService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: genealogydemo
 * @description: 成员服务类
 * @author: Hekejian
 * @time: 2020-07-05 21:21
 **/
@Service
public class MemberServiceImp implements MemberService {
    @Resource
    MemberMapper memberMapper;
    @Override
    public boolean createRoot(Member member) {
        if (memberMapper.insertRoot(member)==1) return true;
        return false;
    }

    @Override
    public List<Member> getAllMember(Long fid) {
        return memberMapper.getAllMember(fid);
    }

    @Override
    public boolean addChildren(Member member) {
        System.out.println("准备添加后裔");
        if (memberMapper.addChildren(member)==1) return true;
        return false;
    }

    @Override
    public boolean addAccount(Member member) {
        int i = memberMapper.addAccount(member);
        if (i!=0){
            return true;
        }
        return false;
    }


}
